]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Animate window clones using translation properties
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Thu, 16 Jan 2020 10:42:50 +0000 (18:42 +0800)
committerFlorian Müllner <florian.muellner@gmail.com>
Fri, 7 Feb 2020 14:43:56 +0000 (14:43 +0000)
Instead of position x/y properties. This reduces CPU-intensive relayouts
in JavaScript (`vfunc_allocate` etc).

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1271
since the other fix required already landed in 4c4846e9.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/936

js/ui/workspace.js

index d470f7f402839c15c0b09349c23d65175cb2aca3..3cfce9845d63fcd4c692b771f03a1714bd71666d 100644 (file)
@@ -155,8 +155,7 @@ var WindowClone = GObject.registerClass({
 
         this._updateAttachedDialogs();
         this._computeBoundingBox();
-        this.x = this._boundingBox.x;
-        this.y = this._boundingBox.y;
+        this.set_translation(this._boundingBox.x, this._boundingBox.y, 0);
 
         this._computeWindowCenter();
 
@@ -1364,8 +1363,8 @@ class Workspace extends St.Widget {
             if (!clone.positioned) {
                 // This window appeared after the overview was already up
                 // Grow the clone from the center of the slot
-                clone.x = x + cloneWidth / 2;
-                clone.y = y + cloneHeight / 2;
+                clone.translation_x = x + cloneWidth / 2;
+                clone.translation_y = y + cloneHeight / 2;
                 clone.scale_x = 0;
                 clone.scale_y = 0;
                 clone.positioned = true;
@@ -1380,8 +1379,8 @@ class Workspace extends St.Widget {
                         clone.opacity = 0;
                         clone.scale_x = 0;
                         clone.scale_y = 0;
-                        clone.x = x;
-                        clone.y = y;
+                        clone.translation_x = x;
+                        clone.translation_y = y;
                     }
 
                     clone.ease({
@@ -1395,7 +1394,7 @@ class Workspace extends St.Widget {
             } else {
                 // cancel any active tweens (otherwise they might override our changes)
                 clone.remove_all_transitions();
-                clone.set_position(x, y);
+                clone.set_translation(x, y, 0);
                 clone.set_scale(scale, scale);
                 clone.set_opacity(255);
                 clone.overlay.relayout(false);
@@ -1425,7 +1424,8 @@ class Workspace extends St.Widget {
 
     _animateClone(clone, overlay, x, y, scale) {
         clone.ease({
-            x, y,
+            translation_x: x,
+            translation_y: y,
             scale_x: scale,
             scale_y: scale,
             duration: Overview.ANIMATION_TIME,
@@ -1570,7 +1570,7 @@ class Workspace extends St.Widget {
             clone.slot = [x, y, clone.width * scale, clone.height * scale];
             clone.positioned = true;
 
-            clone.set_position(x, y);
+            clone.set_translation(x, y, 0);
             clone.set_scale(scale, scale);
             clone.overlay.relayout(false);
         }
@@ -1725,8 +1725,8 @@ class Workspace extends St.Widget {
             let [origX, origY] = clone.getOriginalPosition();
             clone.scale_x = 1;
             clone.scale_y = 1;
-            clone.x = origX;
-            clone.y = origY;
+            clone.translation_x = origX;
+            clone.translation_y = origY;
             clone.ease({
                 opacity,
                 duration,
@@ -1776,8 +1776,8 @@ class Workspace extends St.Widget {
         if (clone.metaWindow.showing_on_its_workspace()) {
             let [origX, origY] = clone.getOriginalPosition();
             clone.ease({
-                x: origX,
-                y: origY,
+                translation_x: origX,
+                translation_y: origY,
                 scale_x: 1,
                 scale_y: 1,
                 opacity: 255,